package com.whfc.base.dao;

import com.whfc.base.dto.AppWeatherDTO;
import com.whfc.base.entity.AppWeather;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.Date;
import java.util.List;

@Repository
public interface AppWeatherMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(AppWeather record);

    int insertSelective(AppWeather record);

    AppWeather selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(AppWeather record);

    int updateByPrimaryKey(AppWeather record);

    /**
     * 查询一天的天气情况
     *
     * @param deptId
     * @param date
     * @return
     */
    AppWeatherDTO selectWeather(@Param("deptId") Integer deptId, @Param("date") Date date);

    /**
     * 根据deptId 查询天气
     *
     * @param deptId
     * @return
     */
    List<AppWeatherDTO> selectWeatherList(@Param("deptId") Integer deptId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);

    /**
     * 批量更新或插入
     *
     * @param list
     */
    int batchInsertOrUpdate(@Param("appWeatherList") Collection<AppWeatherDTO> list);

    /**
     * 单挑插入or更新天气
     *
     * @param weatherDTO
     * @return
     */
    int insertOrUpdate(AppWeatherDTO weatherDTO);
}